﻿namespace FallingWordsGame
{
    using FallingWordsGame.Interfaces;

    public class Word : IWord
    {
        public Word(string text)
        {
            this.Text = text;
        }

        public string Text 
        {
            get; 
            private set; 
        }

        public int Length
        {
            get
            {
                return this.Text.Length;
            }
        }

        public char this[int index]
        {
            get
            {
                return this.Text[index];
            }

            set
            {
                var textAsArray = this.Text.ToCharArray();
                textAsArray[index] = value;
                this.Text = new string(textAsArray);
            }
        }
    }
}
